﻿namespace VolleyballHall
{
    using System.Collections.Generic;

    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;

    public static class FrameworkExtenstions
    {
        public static List<VertexPositionNormalTexture> TransformPositionBy(this List<VertexPositionNormalTexture> x, Matrix m)
        {
            var res = new List<VertexPositionNormalTexture>(x.Count);
            for (int i = 0; i < x.Count; i++)
            {
                var newPos = Vector3.Transform(x[i].Position, m);
                res.Add(new VertexPositionNormalTexture(newPos, x[i].Normal, x[i].TextureCoordinate));
            }
            return res;
        }


        public static List<VertexPositionNormalTexture> TransformPositionNormalBy(this List<VertexPositionNormalTexture> x, Matrix m)
        {
            var res = new List<VertexPositionNormalTexture>(x.Count);
            for (int i = 0; i < x.Count; i++)
            {
                var newPos = Vector3.Transform(x[i].Position, m);
                var newNormal = Vector3.TransformNormal(x[i].Normal, m);
                res.Add(new VertexPositionNormalTexture(newPos, newNormal, x[i].TextureCoordinate));
            }
            return res;
        }

     
    }
}
